﻿using Castle.ActiveRecord;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Online_Course.Domain
{
    [ActiveRecord]
    public class SysRole:BaseEntity<SysRole>
    {
        [Property(Length = 30, NotNull = false)]
        [Display(Name = "角色名")]
        public string Name { get; set; }

        [Property(Length = 30, NotNull = false)]
        [Display(Name = "状态")]
        public int IsActive { get; set; }

        [HasAndBelongsToMany(typeof(SysUser), Table = "SysUser_SysRole", ColumnRef = "SysUserId", ColumnKey = "SysRoleId", Cascade = ManyRelationCascadeEnum.None, Lazy = false)]
        [Display(Name = "所拥有用户")]
        public IList<SysUser> SysUserList { get; set; }

        [HasAndBelongsToMany(typeof(SystemFunction), Table = "SysRole_SystemFunction", ColumnRef = "SystemFunctionId", ColumnKey = "SysRoleId", Cascade = ManyRelationCascadeEnum.None, Lazy = false)]
        [Display(Name = "角色所拥有菜单")]
        public IList<SystemFunction> SystemFunctionList { get; set; }

    }
}
